<!doctype html>
<html lang="zh-CN">
<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
    <meta name="referrer" content="no-referrer-when-downgrade">
    

    <title>Chrome 插件  | matrix</title>
    <meta property="og:title" content="Chrome 插件  - matrix">
    <meta property="og:type" content="article">
        
    <meta property="article:published_time" content='2021-01-10T14:30:24&#43;08:00'>
        
        
    <meta property="article:modified_time" content='2021-01-10T14:30:24&#43;08:00'>
        
    <meta name="Keywords" content="黑客技术，WEB安全，让你听懂每个漏洞成因，明白每个技术原理,博客,项目管理,python,软件架构,公众号,小程序">
    <meta name="description" content="Chrome 插件 ">
        
    <meta name="author" content="matrix">
    <meta property="og:url" content="https://gitmatrix.gitee.io/post/OWASP-10/Chrome-%E6%8F%92%E4%BB%B6/">
    <link rel="shortcut icon" href='/favicon.ico'  type="image/x-icon">

    <link rel="stylesheet" href='/css/normalize.css'>
    <link rel="stylesheet" href='/css/style.css'>
    <script type="text/javascript" src="//cdn.bootcdn.net/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

    
    
    
        <link href="https://cdn.bootcdn.net/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css" rel="stylesheet">
    
    
    
    
        <link rel="stylesheet" href='/css/douban.css'>
    
        <link rel="stylesheet" href='/css/other.css'>
    
</head>


<body>
    <header id="header" class="clearfix">
    <div class="container">
        <div class="col-group">
            <div class="site-name ">
                
                    <a id="logo" href="https://gitmatrix.gitee.io/">
                        matrix
                    </a>
                
                <p class="description">黑客技术，WEB安全，让你听懂每个漏洞成因，明白每个技术原理</p>
            </div>
            <div>
                <nav id="nav-menu" class="clearfix">
                    <a class="current" href="https://gitmatrix.gitee.io/">首页</a>
                    
                    <a  href="https://gitmatrix.gitee.io/archives/" title="归档">归档</a>
                    
                    <a  href="https://gitmatrix.gitee.io/about/" title="关于">关于</a>
                    
                </nav>
            </div>
        </div>
    </div>
</header>

    <div id="body">
        <div class="container">
            <div class="col-group">

                <div class="col-8" id="main">
                    
<div class="res-cons">
    <style type="text/css">
    .post-toc {
        position: fixed;
        width: 200px;
        margin-left: -210px;
        padding: 5px 10px;
        font-family: Athelas, STHeiti, Microsoft Yahei, serif;
        font-size: 12px;
        border: 1px solid rgba(0, 0, 0, .07);
        border-radius: 5px;
        background-color: rgba(255, 255, 255, 0.98);
        background-clip: padding-box;
        -webkit-box-shadow: 1px 1px 2px rgba(0, 0, 0, .125);
        box-shadow: 1px 1px 2px rgba(0, 0, 0, .125);
        word-wrap: break-word;
        white-space: nowrap;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        z-index: 999;
        cursor: pointer;
        max-height: 70%;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .post-toc .post-toc-title {
        width: 100%;
        margin: 0 auto;
        font-size: 20px;
        font-weight: 400;
        text-transform: uppercase;
        text-align: center;
    }

    .post-toc .post-toc-content {
        font-size: 15px;
    }

    .post-toc .post-toc-content>nav>ul {
        margin: 10px 0;
    }

    .post-toc .post-toc-content ul {
        padding-left: 20px;
        list-style: square;
        margin: 0.5em;
        line-height: 1.8em;
    }

    .post-toc .post-toc-content ul ul {
        padding-left: 15px;
        display: none;
    }

    @media print,
    screen and (max-width:1057px) {
        .post-toc {
            display: none;
        }
    }
</style>
<div class="post-toc" style="position: absolute; top: 188px;">
    <h2 class="post-toc-title">文章目录</h2>
    <div class="post-toc-content">
        <nav id="TableOfContents">
  <ul>
    <li><a href="#什么是chrome插件">什么是Chrome插件</a></li>
    <li><a href="#22-学习chrome插件开发有什么意义">2.2. 学习Chrome插件开发有什么意义</a></li>
    <li><a href="#23-为什么是chrome插件而不是firefox插件">2.3. 为什么是Chrome插件而不是Firefox插件</a></li>
  </ul>

  <ul>
    <li><a href="#41-manifestjson">4.1. manifest.json</a></li>
  </ul>
</nav>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        var postToc = $(".post-toc");
        if (postToc.length) {
            var leftPos = $("#main").offset().left;
            if(leftPos<220){
                postToc.css({"width":leftPos-10,"margin-left":(0-leftPos)})
            }

            var t = postToc.offset().top - 20,
                a = {
                    start: {
                        position: "absolute",
                        top: t
                    },
                    process: {
                        position: "fixed",
                        top: 20
                    },
                };
            $(window).scroll(function () {
                var e = $(window).scrollTop();
                e < t ? postToc.css(a.start) : postToc.css(a.process)
            })
        }
    })
</script>
    <article class="post">
        <header>
            <h1 class="post-title">Chrome 插件 </h1>
        </header>
        <date class="post-meta meta-date">
            2021年1月10日
        </date>
        
        <div class="post-meta">
            <span>|</span>
            
            <span class="meta-category"><a href='/categories/Web-%E5%AE%89%E5%85%A8'>Web 安全</a></span>
            
            <span class="meta-category"><a href='/categories/web%E5%9F%BA%E7%A1%80'>web基础</a></span>
            
        </div>
        
        
        <div class="post-meta">
            <span id="busuanzi_container_page_pv">|<span id="busuanzi_value_page_pv"></span><span>
                    阅读</span></span>
        </div>
        
        
        <div class="clear" style="display: none">
            <div class="toc-article">
                <div class="toc-title">文章目录</div>
            </div>
        </div>
        
        <div class="post-content">
            <h1 id="chrome-extension">Chrome Extension</h1>
<h2 id="什么是chrome插件">什么是Chrome插件</h2>
<p>严格来讲，我们正在说的东西应该叫Chrome扩展(<code>Chrome Extension</code>)，真正意义上的Chrome插件是更底层的浏览器功能扩展，可能需要对浏览器源码有一定掌握才有能力去开发。鉴于Chrome插件的叫法已经习惯，本文也全部采用这种叫法，但读者需深知本文所描述的Chrome插件实际上指的是Chrome扩展。</p>
<p>Chrome插件是一个用Web技术开发、用来增强浏览器功能的软件，它其实就是一个由HTML、CSS、JS、图片等资源组成的一个<a href="https://developer.chrome.com/extensions/crx">.crx</a>后缀的压缩包.</p>
<p>个人猜测<code>crx</code>可能是<code>Chrome Extension</code>如下3个字母的简写：</p>
<p>
        <a data-fancybox="gallery" href="https://i.loli.net/2021/01/15/IFphekcfMHV5Rr4.png">
            <img class="mx-auto" alt="img" src="https://i.loli.net/2021/01/15/IFphekcfMHV5Rr4.png" />
        </a>
    </p>
<p>另外，其实不只是前端技术，Chrome插件还可以配合C++编写的dll动态链接库实现一些更底层的功能(NPAPI)，比如全屏幕截图。</p>
<p>
        <a data-fancybox="gallery" href="https://i.loli.net/2021/01/15/7frGLD4KTid3XH8.png">
            <img class="mx-auto" alt="img" src="https://i.loli.net/2021/01/15/7frGLD4KTid3XH8.png" />
        </a>
    </p>
<blockquote>
<p>由于安全原因，Chrome浏览器42以上版本已经陆续不再支持NPAPI插件，取而代之的是更安全的PPAPI。</p>
</blockquote>
<h2 id="22-学习chrome插件开发有什么意义">2.2. 学习Chrome插件开发有什么意义</h2>
<p>增强浏览器功能，轻松实现属于自己的“定制版”浏览器，等等。</p>
<p>Chrome插件提供了很多实用API供我们使用，包括但不限于：</p>
<ul>
<li>书签控制；</li>
<li>下载控制；</li>
<li>窗口控制；</li>
<li>标签控制；</li>
<li>网络请求控制，各类事件监听；</li>
<li>自定义原生菜单；</li>
<li>完善的通信机制；</li>
<li>等等；</li>
</ul>
<h2 id="23-为什么是chrome插件而不是firefox插件">2.3. 为什么是Chrome插件而不是Firefox插件</h2>
<ol>
<li>Chrome占有率更高，更多人用；</li>
<li>开发更简单；</li>
<li>应用场景更广泛，Firefox插件只能运行在Firefox上，而Chrome除了Chrome浏览器之外，还可以运行在所有webkit内核的国产浏览器，比如360极速浏览器、360安全浏览器、搜狗浏览器、QQ浏览器等等；</li>
<li>除此之外，Firefox浏览器也对Chrome插件的运行提供了一定的支持；</li>
</ol>
<h1 id="开发与调试">开发与调试</h1>
<p>Chrome插件没有严格的项目结构要求，只要保证本目录有一个<code>manifest.json</code>即可，也不需要专门的IDE，普通的web开发工具即可。</p>
<p>从右上角菜单-&gt;更多工具-&gt;扩展程序可以进入 插件管理页面，也可以直接在地址栏输入 chrome://extensions 访问。</p>
<p>
        <a data-fancybox="gallery" href="img/352797-20170711101025931-1366345527.png">
            <img class="mx-auto" alt="img" src="img/352797-20170711101025931-1366345527.png" />
        </a>
    </p>
<p>勾选<code>开发者模式</code>即可以文件夹的形式直接加载插件，否则只能安装<code>.crx</code>格式的文件。Chrome要求插件必须从它的Chrome应用商店安装，其它任何网站下载的都无法直接安装，所以，其实我们可以把<code>crx</code>文件解压，然后通过开发者模式直接加载。</p>
<p>开发中，代码有任何改动都必须重新加载插件，只需要在插件管理页按下<code>Ctrl+R</code>即可，以防万一最好还把页面刷新一下。</p>
<h1 id="核心介绍">核心介绍</h1>
<h2 id="41-manifestjson">4.1. manifest.json</h2>
<p>这是一个Chrome插件最重要也是必不可少的文件，用来配置所有和插件相关的配置，必须放在根目录。其中，<code>manifest_version</code>、<code>name</code>、<code>version</code>3个是必不可少的，<code>description</code>和<code>icons</code>是推荐的。</p>
<p>下面给出的是一些常见的配置项，均有中文注释，完整的配置文档请戳<a href="https://developer.chrome.com/extensions/manifest">这里</a>。</p>
<div class="highlight"><div style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4">
<table style="border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">11
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">12
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">13
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">14
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">15
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">16
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">17
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">18
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">19
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">20
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">21
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">22
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">23
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">24
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">25
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">26
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">27
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">28
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">29
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">30
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">31
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">32
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">33
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">34
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">35
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">36
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">37
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">38
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">39
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">40
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">41
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">42
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">43
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">44
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">45
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">46
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">47
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">48
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">49
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">50
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">51
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">52
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">53
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">54
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">55
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">56
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">57
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">58
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">59
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">60
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">61
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">62
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">63
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">64
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">65
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">66
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">67
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">68
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">69
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">70
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">71
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">72
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">73
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">74
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">75
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">76
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">77
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">78
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">79
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">80
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">81
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">82
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">83
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">84
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">85
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">86
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">87
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">88
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">89
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">90
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">91
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">92
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">93
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">94
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">95
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">96
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-json" data-lang="json">{
	<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">清单文件的版本，这个必须写，而且必须是2</span>
	<span style="color:#000080">&#34;manifest_version&#34;</span>: <span style="color:#099">2</span>,
	<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">插件的名称</span>
	<span style="color:#000080">&#34;name&#34;</span>: <span style="color:#d14">&#34;demo&#34;</span>,
	<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">插件的版本</span>
	<span style="color:#000080">&#34;version&#34;</span>: <span style="color:#d14">&#34;1.0.0&#34;</span>,
	<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">插件描述</span>
	<span style="color:#000080">&#34;description&#34;</span>: <span style="color:#d14">&#34;简单的Chrome扩展demo&#34;</span>,
	<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">图标，一般偷懒全部用一个尺寸的也没问题</span>
	<span style="color:#000080">&#34;icons&#34;</span>:
	{
		<span style="color:#000080">&#34;16&#34;</span>: <span style="color:#d14">&#34;img/icon.png&#34;</span>,
		<span style="color:#000080">&#34;48&#34;</span>: <span style="color:#d14">&#34;img/icon.png&#34;</span>,
		<span style="color:#000080">&#34;128&#34;</span>: <span style="color:#d14">&#34;img/icon.png&#34;</span>
	},
	<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">会一直常驻的后台JS或后台页面</span>
	<span style="color:#000080">&#34;background&#34;</span>:
	{
		<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">2种指定方式，如果指定JS，那么会自动生成一个背景页</span>
		<span style="color:#000080">&#34;page&#34;</span>: <span style="color:#d14">&#34;background.html&#34;</span>
		<span style="color:#a61717;background-color:#e3d2d2">//</span><span style="color:#d14">&#34;scripts&#34;</span>: [<span style="color:#d14">&#34;js/background.js&#34;</span>]
	},
	<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">浏览器右上角图标设置，browser_action、page_action、app必须三选一</span>
	<span style="color:#000080">&#34;browser_action&#34;</span>: 
	{
		<span style="color:#000080">&#34;default_icon&#34;</span>: <span style="color:#d14">&#34;img/icon.png&#34;</span>,
		<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">图标悬停时的标题，可选</span>
		<span style="color:#000080">&#34;default_title&#34;</span>: <span style="color:#d14">&#34;这是一个示例Chrome插件&#34;</span>,
		<span style="color:#000080">&#34;default_popup&#34;</span>: <span style="color:#d14">&#34;popup.html&#34;</span>
	},
	<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">当某些特定页面打开才显示的图标</span>
	<span style="color:#a61717;background-color:#e3d2d2">/*</span><span style="color:#000080">&#34;page_action&#34;</span>:
	{
		<span style="color:#000080">&#34;default_icon&#34;</span>: <span style="color:#d14">&#34;img/icon.png&#34;</span>,
		<span style="color:#000080">&#34;default_title&#34;</span>: <span style="color:#d14">&#34;我是pageAction&#34;</span>,
		<span style="color:#000080">&#34;default_popup&#34;</span>: <span style="color:#d14">&#34;popup.html&#34;</span>
	},<span style="color:#a61717;background-color:#e3d2d2">*/</span>
	<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">需要直接注入页面的JS</span>
	<span style="color:#000080">&#34;content_scripts&#34;</span>: 
	[
		{
			<span style="color:#a61717;background-color:#e3d2d2">//</span><span style="color:#000080">&#34;matches&#34;</span>: [<span style="color:#d14">&#34;http://*/*&#34;</span>, <span style="color:#d14">&#34;https://*/*&#34;</span>],
			<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#000080">&#34;&lt;all_urls&gt;&#34;</span> <span style="color:#a61717;background-color:#e3d2d2">表示匹配所有地址</span>
			<span style="color:#d14">&#34;matches&#34;</span>: [<span style="color:#d14">&#34;&lt;all_urls&gt;&#34;</span>],
			<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">多个JS按顺序注入</span>
			<span style="color:#000080">&#34;js&#34;</span>: [<span style="color:#d14">&#34;js/jquery-1.8.3.js&#34;</span>, <span style="color:#d14">&#34;js/content-script.js&#34;</span>],
			<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">JS的注入可以随便一点，但是CSS的注意就要千万小心了，因为一不小心就可能影响全局样式</span>
			<span style="color:#000080">&#34;css&#34;</span>: [<span style="color:#d14">&#34;css/custom.css&#34;</span>],
			<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">代码注入的时间，可选值：</span> <span style="color:#000080">&#34;document_start&#34;</span>, <span style="color:#000080">&#34;document_end&#34;</span>, <span style="color:#a61717;background-color:#e3d2d2">or</span> <span style="color:#000080">&#34;document_idle&#34;</span><span style="color:#a61717;background-color:#e3d2d2">，最后一个表示页面空闲时，默认document_idle</span>
			<span style="color:#d14">&#34;run_at&#34;</span>: <span style="color:#d14">&#34;document_start&#34;</span>
		},
		<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">这里仅仅是为了演示content-script可以配置多个规则</span>
		{
			<span style="color:#000080">&#34;matches&#34;</span>: [<span style="color:#d14">&#34;*://*/*.png&#34;</span>, <span style="color:#d14">&#34;*://*/*.jpg&#34;</span>, <span style="color:#d14">&#34;*://*/*.gif&#34;</span>, <span style="color:#d14">&#34;*://*/*.bmp&#34;</span>],
			<span style="color:#000080">&#34;js&#34;</span>: [<span style="color:#d14">&#34;js/show-image-content-size.js&#34;</span>]
		}
	],
	<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">权限申请</span>
	<span style="color:#000080">&#34;permissions&#34;</span>:
	[
		<span style="color:#d14">&#34;contextMenus&#34;</span>, <span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">右键菜单</span>
		<span style="color:#d14">&#34;tabs&#34;</span>, <span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">标签</span>
		<span style="color:#d14">&#34;notifications&#34;</span>, <span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">通知</span>
		<span style="color:#d14">&#34;webRequest&#34;</span>, <span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">web请求</span>
		<span style="color:#d14">&#34;webRequestBlocking&#34;</span>,
		<span style="color:#d14">&#34;storage&#34;</span>, <span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">插件本地存储</span>
		<span style="color:#d14">&#34;http://*/*&#34;</span>, <span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">可以通过executeScript或者insertCSS访问的网站</span>
		<span style="color:#d14">&#34;https://*/*&#34;</span> <span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">可以通过executeScript或者insertCSS访问的网站</span>
	],
	<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">普通页面能够直接访问的插件资源列表，如果不设置是无法直接访问的</span>
	<span style="color:#000080">&#34;web_accessible_resources&#34;</span>: [<span style="color:#d14">&#34;js/inject.js&#34;</span>],
	<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">插件主页，这个很重要，不要浪费了这个免费广告位</span>
	<span style="color:#000080">&#34;homepage_url&#34;</span>: <span style="color:#d14">&#34;https://www.baidu.com&#34;</span>,
	<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">覆盖浏览器默认页面</span>
	<span style="color:#000080">&#34;chrome_url_overrides&#34;</span>:
	{
		<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">覆盖浏览器默认的新标签页</span>
		<span style="color:#000080">&#34;newtab&#34;</span>: <span style="color:#d14">&#34;newtab.html&#34;</span>
	},
	<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">Chrome40以前的插件配置页写法</span>
	<span style="color:#000080">&#34;options_page&#34;</span>: <span style="color:#d14">&#34;options.html&#34;</span>,
	<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">Chrome40以后的插件配置页写法，如果2个都写，新版Chrome只认后面这一个</span>
	<span style="color:#000080">&#34;options_ui&#34;</span>:
	{
		<span style="color:#000080">&#34;page&#34;</span>: <span style="color:#d14">&#34;options.html&#34;</span>,
		<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">添加一些默认的样式，推荐使用</span>
		<span style="color:#000080">&#34;chrome_style&#34;</span>: <span style="color:#000;font-weight:bold">true</span>
	},
	<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">向地址栏注册一个关键字以提供搜索建议，只能设置一个关键字</span>
	<span style="color:#000080">&#34;omnibox&#34;</span>: { <span style="color:#000080">&#34;keyword&#34;</span> : <span style="color:#d14">&#34;go&#34;</span> },
	<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">默认语言</span>
	<span style="color:#000080">&#34;default_locale&#34;</span>: <span style="color:#d14">&#34;zh_CN&#34;</span>,
	<span style="color:#a61717;background-color:#e3d2d2">//</span> <span style="color:#a61717;background-color:#e3d2d2">devtools页面入口，注意只能指向一个HTML文件，不能是JS文件</span>
	<span style="color:#000080">&#34;devtools_page&#34;</span>: <span style="color:#d14">&#34;devtools.html&#34;</span>
}
</code></pre></td></tr></table>
</div>
</div>
        </div>

        


        

<div class="post-archive">
    <h2>See Also</h2>
    <ul class="listing">
        
        <li><a href="/post/OWASP-10/CSRF-%E8%B7%A8%E7%AB%99%E8%AF%B7%E6%B1%82%E4%BC%AA%E9%80%A0/">CSRF 跨站请求伪造 </a></li>
        
        <li><a href="/post/%E4%BF%A1%E6%81%AF%E6%94%B6%E9%9B%86/Google-hacking/">Google hacking </a></li>
        
        <li><a href="/post/web-%E5%9F%BA%E7%A1%80/js-%E7%89%B9%E5%AE%9A%E5%8A%9F%E8%83%BD/">JavaScript 代码片段 </a></li>
        
        <li><a href="/post/OWASP-10/SQL-%E6%B3%A8%E5%85%A5/">SQL注入 </a></li>
        
        <li><a href="/post/OWASP-10/XSS-%E8%B7%A8%E7%AB%99%E8%84%9A%E6%9C%AC%E6%94%BB%E5%87%BB/">XSS 跨站脚本漏洞 </a></li>
        
    </ul>
</div>


        <div class="post-meta meta-tags">
            
            <ul class="clearfix">
                
                <li><a href='/tags/Chrome-Extension'>Chrome Extension</a></li>
                
                <li><a href='/tags/Chrome%E6%8F%92%E4%BB%B6'>Chrome插件</a></li>
                
            </ul>
            
        </div>
    </article>
    
    

    
    
</div>

                    <footer id="footer">
    <div>
        &copy; 2021 <a href="https://gitmatrix.gitee.io/">matrix By matrix</a>
        
    </div>
    <br />
    
    <div>
        <div class="github-badge">
            <a href="https://gohugo.io/" target="_black" rel="nofollow"><span class="badge-subject">Powered by</span><span class="badge-value bg-blue">Hugo</span></a>
        </div>
        
        <div class="github-badge">
            <a href="https://github.com/flysnow-org/maupassant-hugo" target="_black"><span class="badge-subject">Theme</span><span class="badge-value bg-yellowgreen">Maupassant</span></a>
        </div>
    </div>
</footer>


    
    <script type="text/javascript">
        window.MathJax = {
            tex2jax: {
                inlineMath: [['$', '$']],
                processEscapes: true
                }
            };
    </script>
    <script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML' async></script><script src="https://cdn.bootcdn.net/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.js"></script>

<a id="rocket" href="#top"></a>
<script type="text/javascript" src='/js/totop.js?v=0.0.0' async=""></script>



    <script type="text/javascript" src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" async></script>




    <script src='/js/douban.js'></script>

                </div>

                <div id="secondary">
    <section class="widget">
        <form id="search" action='https://gitmatrix.gitee.io/search/' method="get" accept-charset="utf-8" target="_blank" _lpchecked="1">
      
      <input type="text" name="q" maxlength="20" placeholder="Search">
      <input type="hidden" name="sitesearch" value="https://gitmatrix.gitee.io/">
      <button type="submit" class="submit icon-search"></button>
</form>
    </section>
    
    <section class="widget">
        <h3 class="widget-title">最近文章</h3>
<ul class="widget-list">
    
    <li>
        <a href="https://gitmatrix.gitee.io/post/Linux-%E5%9F%BA%E7%A1%80%E9%85%8D%E7%BD%AE/linux-%E5%9F%BA%E7%A1%80%E9%85%8D%E7%BD%AE/" title="Linux 基础配置 ">Linux 基础配置 </a>
    </li>
    
    <li>
        <a href="https://gitmatrix.gitee.io/post/Linux-%E5%9F%BA%E7%A1%80%E9%85%8D%E7%BD%AE/linux-%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4-/" title="Linux 常用命令 ">Linux 常用命令 </a>
    </li>
    
    <li>
        <a href="https://gitmatrix.gitee.io/post/Linux-%E5%9F%BA%E7%A1%80%E9%85%8D%E7%BD%AE/Linux%E6%96%87%E4%BB%B6%E7%89%B9%E6%AE%8A%E6%9D%83%E9%99%90SUIDSGID%E4%B8%8ESBIT/" title="Linux文件特殊权限 ">Linux文件特殊权限 </a>
    </li>
    
    <li>
        <a href="https://gitmatrix.gitee.io/post/Linux-%E5%9F%BA%E7%A1%80%E9%85%8D%E7%BD%AE/Linux-%E7%A3%81%E7%9B%98%E6%8C%82%E8%BD%BD/" title="Liunx 磁盘分区与文件挂载 ">Liunx 磁盘分区与文件挂载 </a>
    </li>
    
    <li>
        <a href="https://gitmatrix.gitee.io/post/Mysql-%E6%95%B0%E6%8D%AE%E5%BA%93/my.cnf-%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E8%AF%A6%E8%A7%A3/" title="my.cnf 配置文件详解">my.cnf 配置文件详解</a>
    </li>
    
    <li>
        <a href="https://gitmatrix.gitee.io/post/Mysql-%E6%95%B0%E6%8D%AE%E5%BA%93/Mysql-%E6%93%8D%E4%BD%9C/" title="Mysql 基本操作">Mysql 基本操作</a>
    </li>
    
    <li>
        <a href="https://gitmatrix.gitee.io/post/Mysql-%E6%95%B0%E6%8D%AE%E5%BA%93/Mysql%E4%BD%93%E7%B3%BB%E7%BB%93%E6%9E%84%E7%AE%A1%E7%90%86/" title="Mysql体系结构管理">Mysql体系结构管理</a>
    </li>
    
    <li>
        <a href="https://gitmatrix.gitee.io/post/Linux-%E5%9F%BA%E7%A1%80%E9%85%8D%E7%BD%AE/RAID-%E7%A3%81%E7%9B%98%E9%98%B5%E5%88%97/" title="RAID 磁盘阵列配置 ">RAID 磁盘阵列配置 </a>
    </li>
    
    <li>
        <a href="https://gitmatrix.gitee.io/post/Linux-%E5%9F%BA%E7%A1%80%E9%85%8D%E7%BD%AE/rpm-%E4%B8%8E-yum-/" title="RPM 与 Yum ">RPM 与 Yum </a>
    </li>
    
    <li>
        <a href="https://gitmatrix.gitee.io/post/SSH/SSH-%E5%9F%BA%E6%9C%AC%E6%93%8D%E4%BD%9C/" title="SSH 基本操作">SSH 基本操作</a>
    </li>
    
</ul>
    </section>

    
<section class="widget">
    <h3 class="widget-title" style="color:#6E718A">课程直达</h3>
    <ul class="widget-list">
        
        <li>
            <a href="https://www.bilibili.com/video/BV1nA411h7C9" title="Burpsuite使用教程" target="_blank" style="color:#6E718A">
                
                    <img src="https://gitee.com/gitmatrix/images/raw/master/img/20210116152721.png">
                
            </a>
        </li>
        
        <li>
            <a href="https://www.bilibili.com/video/BV1yf4y1i7Pb?p=1" title="网络安全提升技术与渗透测试原理深度解析" target="_blank" style="color:#6E718A">
                
                    <img src="https://gitee.com/gitmatrix/images/raw/master/img/6f19fe2958f4d3c5edaee825cda334bac074abc8.jpg">
                
            </a>
        </li>
        
    </ul>
</section>


    <section class="widget">
        <h3 class="widget-title"><a href='/categories/'>分类</a></h3>
<ul class="widget-list">
    
    <li><a href="https://gitmatrix.gitee.io/categories/Liunx/">Liunx (6)</a></li>
    
    <li><a href="https://gitmatrix.gitee.io/categories/Mysql/">Mysql (3)</a></li>
    
    <li><a href="https://gitmatrix.gitee.io/categories/SSH/">SSH (4)</a></li>
    
    <li><a href="https://gitmatrix.gitee.io/categories/Test/">Test (1)</a></li>
    
    <li><a href="https://gitmatrix.gitee.io/categories/Web-%E5%AE%89%E5%85%A8/">Web 安全 (9)</a></li>
    
    <li><a href="https://gitmatrix.gitee.io/categories/web%E5%9F%BA%E7%A1%80/">web基础 (1)</a></li>
    
    <li><a href="https://gitmatrix.gitee.io/categories/%E4%BF%A1%E6%81%AF%E6%94%B6%E9%9B%86/">信息收集 (10)</a></li>
    
    <li><a href="https://gitmatrix.gitee.io/categories/%E5%8D%81%E5%A4%A7%E6%BC%8F%E6%B4%9E/">十大漏洞 (8)</a></li>
    
    <li><a href="https://gitmatrix.gitee.io/categories/%E6%95%99%E7%A8%8B/">教程 (1)</a></li>
    
    <li><a href="https://gitmatrix.gitee.io/categories/%E7%BD%91%E7%BB%9C%E5%AE%89%E5%85%A8%E6%B3%95/">网络安全法 (1)</a></li>
    
    <li><a href="https://gitmatrix.gitee.io/categories/%E8%BF%90%E7%BB%B4/">运维 (2)</a></li>
    
</ul>
    </section>

    <section class="widget">
        <h3 class="widget-title"><a href='/tags/'>标签</a></h3>
<div class="tagcloud">
    
    <a href="https://gitmatrix.gitee.io/tags/CSRF/">CSRF</a>
    
    <a href="https://gitmatrix.gitee.io/tags/Chrome-Extension/">Chrome Extension</a>
    
    <a href="https://gitmatrix.gitee.io/tags/Chrome%E6%8F%92%E4%BB%B6/">Chrome插件</a>
    
    <a href="https://gitmatrix.gitee.io/tags/Google-hacking/">Google hacking</a>
    
    <a href="https://gitmatrix.gitee.io/tags/JavaScript/">JavaScript</a>
    
    <a href="https://gitmatrix.gitee.io/tags/Linux/">Linux</a>
    
    <a href="https://gitmatrix.gitee.io/tags/Mysql/">Mysql</a>
    
    <a href="https://gitmatrix.gitee.io/tags/Payload/">Payload</a>
    
    <a href="https://gitmatrix.gitee.io/tags/XSS/">XSS</a>
    
    <a href="https://gitmatrix.gitee.io/tags/Zabbix/">Zabbix</a>
    
    <a href="https://gitmatrix.gitee.io/tags/js/">js</a>
    
    <a href="https://gitmatrix.gitee.io/tags/Mysql/">Mysql</a>
    
    <a href="https://gitmatrix.gitee.io/tags/sql/">sql</a>
    
    <a href="https://gitmatrix.gitee.io/tags/ssh/">ssh</a>
    
    <a href="https://gitmatrix.gitee.io/tags/test/">test</a>
    
    <a href="https://gitmatrix.gitee.io/tags/%E4%B8%AD%E5%8D%8E%E4%BA%BA%E6%B0%91%E5%85%B1%E5%92%8C%E5%9B%BD%E7%BD%91%E7%BB%9C%E5%AE%89%E5%85%A8%E6%B3%95/">中华人民共和国网络安全法</a>
    
    <a href="https://gitmatrix.gitee.io/tags/%E5%9F%BA%E6%9C%AC%E4%BF%A1%E6%81%AF%E6%94%B6%E9%9B%86/">基本信息收集</a>
    
    <a href="https://gitmatrix.gitee.io/tags/%E6%8C%87%E7%BA%B9%E8%AF%86%E5%88%AB/">指纹识别</a>
    
    <a href="https://gitmatrix.gitee.io/tags/%E6%94%B6%E9%9B%86%E5%AD%90%E5%9F%9F%E4%BF%A1%E6%81%AF/">收集子域信息</a>
    
    <a href="https://gitmatrix.gitee.io/tags/%E6%94%B6%E9%9B%86%E6%95%8F%E6%84%9F%E7%9B%AE%E5%BD%95%E6%96%87%E4%BB%B6/">收集敏感目录文件</a>
    
    <a href="https://gitmatrix.gitee.io/tags/%E6%94%BB%E5%87%BB/">攻击</a>
    
    <a href="https://gitmatrix.gitee.io/tags/%E6%95%99%E7%A8%8B/">教程</a>
    
    <a href="https://gitmatrix.gitee.io/tags/%E6%95%B4%E7%AB%99%E5%88%86%E6%9E%90/">整站分析</a>
    
    <a href="https://gitmatrix.gitee.io/tags/%E6%96%87%E4%BB%B6/">文件</a>
    
    <a href="https://gitmatrix.gitee.io/tags/%E6%B8%97%E9%80%8F%E6%B5%8B%E8%AF%95%E4%BB%8B%E7%BB%8D/">渗透测试介绍</a>
    
    <a href="https://gitmatrix.gitee.io/tags/%E6%B8%97%E9%80%8F%E6%B5%8B%E8%AF%95%E6%B5%81%E7%A8%8B/">渗透测试流程</a>
    
    <a href="https://gitmatrix.gitee.io/tags/%E6%BC%8F%E6%B4%9E/">漏洞</a>
    
    <a href="https://gitmatrix.gitee.io/tags/%E7%9C%9F%E5%AE%9EIP%E5%9C%B0%E5%9D%80%E6%9F%A5%E8%AF%A2/">真实IP地址查询</a>
    
    <a href="https://gitmatrix.gitee.io/tags/%E9%9D%B6%E5%9C%BA/">靶场</a>
    
</div>
    </section>

    
<section class="widget">
    <h3 class="widget-title">友情链接</h3>
    <ul class="widget-list">
        
        <li>
            <a target="_blank" href="https://www.bugbank.cn/" title="漏洞银行">漏洞银行</a>
        </li>
        
        <li>
            <a target="_blank" href="https://www.xf1433.com/59.html" title="电脑黑客书籍在线阅读">电脑黑客书籍在线阅读</a>
        </li>
        
        <li>
            <a target="_blank" href="http://yuedu.baidu.com/ebook/14a722970740be1e640e9a3e" title="Android Gradle权威指南">Android Gradle权威指南</a>
        </li>
        
    </ul>
</section>


    <section class="widget">
        <h3 class="widget-title">其它</h3>
        <ul class="widget-list">
            <li><a href="https://gitmatrix.gitee.io/index.xml"></a></li>
        </ul>
    </section>
</div>
            </div>
        </div>
    </div>
</body>

</html>